/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package EC;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author TrangNHIT
 */
@Entity
@Table(name = "tbStates")
@NamedQueries({
    @NamedQuery(name = "States.findAll", query = "SELECT s FROM States s"),
    @NamedQuery(name = "States.findByStateID", query = "SELECT s FROM States s WHERE s.stateID = :stateID"),
    @NamedQuery(name = "States.findByStateName", query = "SELECT s FROM States s WHERE s.stateName = :stateName"),
    @NamedQuery(name = "States.findByStateDescription", query = "SELECT s FROM States s WHERE s.stateDescription = :stateDescription")})
public class States implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "State_ID")
    private Integer stateID;
    @Basic(optional = false)
    @Column(name = "State_Name")
    private String stateName;
    @Column(name = "State_Description")
    private String stateDescription;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "states")
    private List<Markets> marketsList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "states")
    private List<Customers> customersList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "states")
    private List<Products> productsList;

    public States() {
    }

    public States(Integer stateID) {
        this.stateID = stateID;
    }

    public States(Integer stateID, String stateName) {
        this.stateID = stateID;
        this.stateName = stateName;
    }

    public Integer getStateID() {
        return stateID;
    }

    public void setStateID(Integer stateID) {
        this.stateID = stateID;
    }

    public String getStateName() {
        return stateName;
    }

    public void setStateName(String stateName) {
        this.stateName = stateName;
    }

    public String getStateDescription() {
        return stateDescription;
    }

    public void setStateDescription(String stateDescription) {
        this.stateDescription = stateDescription;
    }

    public List<Markets> getMarketsList() {
        return marketsList;
    }

    public void setMarketsList(List<Markets> marketsList) {
        this.marketsList = marketsList;
    }

    public List<Customers> getCustomersList() {
        return customersList;
    }

    public void setCustomersList(List<Customers> customersList) {
        this.customersList = customersList;
    }

    public List<Products> getProductsList() {
        return productsList;
    }

    public void setProductsList(List<Products> productsList) {
        this.productsList = productsList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (stateID != null ? stateID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof States)) {
            return false;
        }
        States other = (States) object;
        if ((this.stateID == null && other.stateID != null) || (this.stateID != null && !this.stateID.equals(other.stateID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "EC.States[stateID=" + stateID + "]";
    }

}
